<template>
    <div class="notice-box">
        <div class="title-box">
            <div class="title-icon-box">
                <img src="https://jy-club.oss-cn-shanghai.aliyuncs.com//iamges/icon/notice-2.png" style="width: 100%" alt="">
            </div>
            <div class="title-text-box">
                公告通知
            </div>
        </div>
        <div class="line-box"></div>
        <div class="body-content-box" v-loading="load">
            <div v-for="(item,key) in list.data" :key="key" class="content-item-box" @click="toDetail(item.id)">
                <div class="title-item-box">{{item.title}}</div>
                <div class="time-item-box">{{item.create_time}}</div>
            </div>
            <div style="height: 100px;line-height: 100px;text-align: center" v-if="list.data.length == 0">
                暂无公告
            </div>
        </div>
        <div class="page-box">
            <el-pagination
                    background
                    small
                    :current-page="list.current_page"
                    :page-size="list.per_page"
                    layout="total, prev, pager, next, jumper"
                    :total="list.total"
                    @current-change="changePage"
            ></el-pagination>
        </div>
    </div>
</template>

<script>
    export default {
        name: "notice",
        data(){
            return {
                list:{
                    data:[],
                    per_page:15,
                    total:0,
                },
                load:false,
                form:{
                    page:1,
                },
            }
        },
        mounted() {
            this.getData();
        },
        methods:{
            toDetail(id){
                this.$router.push({
                    path:'/index/index/notice-detail/'+id
                })
            },
            getData(){
                this.load = true;
                this.ajaxs('index/getNotice',{
                    data:this.form,
                    success:(res) => {
                        this.list = res.msg;
                        this.load = false;
                    }
                })
            },
            changePage(e){
                this.form.page = e;
                this.getData();
            },
        },
    }
</script>

<style scoped>
    .time-item-box{
        height: 20px;
        line-height: 20px;
        font-size: 13px;
        color: #cccccc;
    }
    .title-item-box{
        height: 40px;
        line-height: 40px;
        font-size: 16px;
        font-weight: bold;
        color: #333333;
    }
    .content-item-box{
        height: 80px;
        width: 100%;
        cursor: pointer;
    }
    .body-content-box{
        padding: 15px;
    }
    .line-box{
        border-top: 1px #F1F1F1 solid;
        margin-top: 20px;
    }
    .notice-box{
        width: 1000px;
        margin: 20px auto;
        background-color: #FFFFFF;
        padding: 20px;
    }
    .title-box{
        height: 60px;
        line-height: 60px;
        display: flex;
        align-items: center;
    }
    .title-icon-box{
        height: 60px;
        width: 24px;
        line-height: 74px;
    }
    .title-text-box{
        height: 60px;
        line-height: 60px;
        margin-left: 10px;
        font-size: 19px;
        font-weight: bold;

    }
</style>
